var GameData = require('GameData');
var ObserverMgr = require('ObserverMgr');
var NetSocket = require('NetSocket');

cc.Class({
    extends: cc.Component,

    properties: {
        roomIDLabel: {default: null, displayName: "房间号", type: cc.Label},
        playNumLabel: {default: null, displayName: "剩余局数", type: cc.Label},

    },

    onLoad: function () {
        // 房间号
        var roomId = GameData.getRoomID();
        this.roomIDLabel.string = "房间号: " + roomId;

        // 剩余局数
        var totalNum = GameData.data.roomData.totalNum;
        var curNum = GameData.data.roomData.playNum;
        var remainNum = totalNum - curNum;
        this.playNumLabel.string = "剩余 " + remainNum.toString() + " 局";
    },
    // 解散房间
    onClickSet(){
        ObserverMgr.dispatchMsg(GameLocalMsg.GameScene.OnExitRoom, null);
    },

});
